﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;


namespace ConsoleApplicationExceptionHandling
{
    class Program
    {
        static void Main(string[] args)
        {
            var wallet = new Wallet();
            wallet.Add(10);
            try
            {
                wallet.Remove(20);
            }
            catch (NotEnoughAmountException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.MissingAmount);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }


            Download();

            Console.ReadKey();
        }

        public static async void Download()
        {

            using (HttpClient client = new HttpClient())
            {
                try
                {
                    HttpResponseMessage message = await client.GetAsync("http://www.micarmenia.am/");
                    string result = await message.Content.ReadAsStringAsync();

                    Console.WriteLine(result);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
    }
}
